import axiosInstance from '../assets/js/axiosClient'; // 直接导入 axiosInstance
export interface BaseMessage {
  createdAt?: Date; // 创建时间
  senderId?: string; // 发送者ID
  receiverId?: string; // 接收者ID
  content?: string; // 消息内容
}
interface QueryList extends BaseMessage {
  pageSize?: number; // 每页条数
  pageIndex?: number; // 当前页码
}


// 发送消息
export const save = async (params: BaseMessage) => {
  const res = await axiosInstance.post('/messages/save', params)
  return res.data
}
// 获取消息详情
export const messages = (params: QueryList) => {
  return axiosInstance.get('/messages', { params: params })
}

// 获取消息列表
export const list = (params: BaseMessage) => {
  return axiosInstance.get('/messages/list', { params: params })
}

